package com.sdry.service.impl.zm;

import java.util.HashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sdry.mapper.zm.ZmAgentMapper;
import com.sdry.model.zm.ZmAgentEntity;
import com.sdry.model.zm.ZmGeneralQueryEntity;
import com.sdry.service.zm.ZmAgentService;

@Service
public class ZmAgentServiceImpI  implements ZmAgentService {
	
	@Resource
	ZmAgentMapper zmAgentMapper;
	
	@Override
	public boolean addAgent(ZmAgentEntity agent) {
		boolean flag = false;
		System.out.print("Class : AgentService Mathod : addAgent Pram : agent:");
		System.out.println(agent);
		if(agent!=null){
			flag = true;
		}
		return flag;
	}
	@Override
	public boolean delAgent(Long agentId) {
		boolean flag = false;
		System.out.println("Class : AgentService Mathod : delAgent Pram : agentId:" + agentId);
		if(agentId!=null){
			flag = true;
		}
		return flag;
	}
	@Override
	public boolean editAgent(HashMap<String, String> map) {
		boolean flag = false;
		try {
			ZmAgentEntity agentEntity = new ZmAgentEntity(
					Long.valueOf(map.get("agentId"))
					,map.get("name")
					,map.get("type")
					,map.get("taxNum")
					,map.get("contact")
					,map.get("phoneNum")
					,map.get("licenseKey")
					,map.get("licenseTerm")
					,map.get("depositBank")
					,map.get("bankAccount")
					,map.get("address")
					,map.get("landline")
					,map.get("threeToOneNum")
					,map.get("corporation")
					,map.get("coLandline")
					,map.get("coPhoneNum")
					,map.get("productionLicenceNum")
					,map.get("productionLicenceTerm")
					,map.get("businessLicenseNum")
					,map.get("businessLicenseTerm")
					,map.get("authorizationNum")
					,map.get("authorizationTerm")
					,map.get("creditValidity")
					,map.get("creditLimit")
					,map.get("openType")
					,map.get("saleManPowerOfAttorney")
					,map.get("saleman")
					,map.get("salemanIdCardNum")
					,map.get("salemanPhone")
					,map.get("salemanLicenseTerm")
					,map.get("qualityMsg")
					,map.get("qualityMsgNum")
					,map.get("qualityMsgDate")
					,map.get("fDAMsg")
					,map.get("fDAId")
					,map.get("fDADate")
					,map.get("lineOfBusiness")
					,map.get("remarks"));
			flag = true;
		} catch (Exception e) {
		}
		return false;
	}
	@Override
	public List<ZmAgentEntity> getAgentList(ZmGeneralQueryEntity queryEntity) {
		//表名
		String tab = "zm_agent";
		//查询字段
		String strFld = "*";
		//排序
		String sort = "id DESC";
		//0返回结果集，1返回count数
		byte isGetCount = 0;
		queryEntity.setTab(tab);
		queryEntity.setSort(sort);
		queryEntity.setIsGetCount(isGetCount);
		queryEntity.setStrFld(strFld);
		//return zmAgentMapper.getAgentList(queryEntity);
		return null;
	}
	@Override
	public int countAgentList(ZmGeneralQueryEntity queryEntity) {
		//表名
		String tab = "zm_agent";
		//0返回结果集，1返回count数
		byte isGetCount = 1;
		queryEntity.setTab(tab);
		queryEntity.setIsGetCount(isGetCount);
		//return zmAgentMapper.countAgentList(queryEntity);
		return 0;
	}
}
